<?php include dirname(__FILE__).'/common/header.php'; ?>

<?php include dirname(__FILE__).'/common/menu.php'; ?>

var attr = {};
attr.ctrlName = '<?php echo $ctrlName ?>';
attr.game_gift = <?php echo $game_gift ?>;

/*
| -------------------------------------------------------------------
|  List Grid
| -------------------------------------------------------------------
*/
list.grid = new ZM.FormPanel({
    url : list.baseUrl + attr.ctrlName+'/getCode',
    keySubmit:true,
    region:'center',
    buttonAlign:'left',
    buttons:null,
    labelWidth:150,
    defaults:{xtype:'textfield',width:400},
    success:function(res) {
        var win = new ZM.PopUp({
            title:'确认使用卡券领取奖品',
            type:'s',
            items:{
                xtype:'formpanel',
                url:list.baseUrl+ attr.ctrlName+'/validateCode',
                fileUpload:true,
                success:function(res) {
                    //ZM.bo.msg('success',res.detail);
                    win.close();
                    ZM.resetForm(list.grid);
                    Ext.Msg.alert('操作成功', '核销成功!更多信息，请查询核销记录!');
                },
                items:[{
                    xtype:'hidden',
                    name:'code',
                    value: res.addon.code
                },{
                    xtype:'displayfield',
                    fieldLabel:'卡券号',
                    value: res.addon.code
                },{
                    xtype:'displayfield',
                    fieldLabel:'卡券名称',
                    value: ZM.id2name(res.addon.gift_type,attr.game_gift)
                },{
                    xtype:'textfield',
                    name: 'customer_name',
                    fieldLabel:'姓名',
                    allowBlank:false
                },{
                    xtype:'textfield',
                    name: 'customer_car_number',
                    fieldLabel:'车架号',
                    allowBlank:false
                }]
            }
        }).show();
    },
    items:[{
        fieldLabel:'卡券号',
        name:'code',
        allowBlank:false
    },{
        xtype:'button',
        text:'提交',
        hidden:!Ext.permission[attr.ctrlName+'/getCode'.toLowerCase()],
        style:'margin:20px 0 0 155px;',
        width:70,
        handler:function() {ZM.submitForm(list.grid);}
    }]
});

<?php include dirname(__FILE__).'/common/layout.php'; ?>
<?php include dirname(__FILE__).'/common/footer.php'; ?>
